#ifndef __WIZ_MEMORY_PLACEMENT_NEW_TEMPLATE_HPP__SHANHAOBO_19800429__
#define __WIZ_MEMORY_PLACEMENT_NEW_TEMPLATE_HPP__SHANHAOBO_19800429__

namespace Wiz
{
    namespace Memory
    {
        namespace Placement
        {
            template<class AllocatorT, typename ElementT>
            WIZ_INLINE ::Wiz::Void::Type Delete(ElementT* EPtr)
            {
                typedef AllocatorT      tAllocator;

                EPtr->~ElementT();
                tAllocator::Deallocate(EPtr);
            }
        } /// end of namespace Placement
    } /// end of namespace Memory
} /// end of namespace Wiz

#endif /*__WIZ_MEMORY_PLACEMENT_NEW_TEMPLATE_HPP__SHANHAOBO_19800429__*/

#undef WIZ_MEMORY_NEW_PARAM_COUNT
#define WIZ_MEMORY_NEW_PARAM_COUNT WIZ_MPP_REPEAT_FILE_COUNT
#if defined(WIZ_MEMORY_NEW_PARAM_COUNT) && (WIZ_MEMORY_NEW_PARAM_COUNT >= 0) && (WIZ_MEMORY_NEW_PARAM_COUNT < 255)

namespace Wiz
{
    namespace Memory
    {
        namespace Placement
        {
            template<class AllocatorT, typename ElementT WIZ_COMMA_IF(WIZ_MEMORY_NEW_PARAM_COUNT) WIZ_ENUM_PARAM_X(WIZ_MEMORY_NEW_PARAM_COUNT, class T)>
            WIZ_INLINE ElementT* New(WIZ_ENUM_PARAM_XY(WIZ_MEMORY_NEW_PARAM_COUNT, T, A))
            {
                typedef AllocatorT      tAllocator;
                typedef ElementT        tElement;

                ::Wiz::Void::Ptr VPtr = tAllocator::Allocate(sizeof(tElement));
                try
                {
                    return new(VPtr) tElement(WIZ_ENUM_PARAM_X(WIZ_MEMORY_NEW_PARAM_COUNT, A));
                }
                catch (...)
                {
                    tAllocator::Deallocate(VPtr);
                    throw;
                }
            }
        } /// end of namespace Placement
    } /// end of namespace Memory
} /// end of namespace Wiz

#endif /*(WIZ_MEMORY_NEW_PARAM_COUNT) && (WIZ_MEMORY_NEW_PARAM_COUNT >= 0) && (WIZ_MEMORY_NEW_PARAM_COUNT < 255)*/
